<!DOCTYPE html>
<html lang="en" ng-app='loklak'>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="Content-Language" content="en, english"/>
    <meta name="author" content="@treba123">
    <link rel="icon" type="image/png" href="favicon.png">
    <title>Installation Wizard</title>
      
    <link href="css/bootstrap.min.css" rel="stylesheet" type="text/css">
    <link href="css/dashboard.css" rel="stylesheet" type="text/css">
    <link href="css/loklak.css" rel="stylesheet" type="text/css">
    <link href="css/style.css" rel="stylesheet" type="text/css">

  </head>

  <body>

    <div id="form">
      <h1>Installation Wizard</h1>
      <br>
      <form id="installation">

        <div id="step0" class="section">

          <h2>Admin account</h2>
          <input name='adminEmail' type="email" id="admin_email" placeholder="Email" required>
          <div class="bar"><i></i></div>
          <input name='adminPassword' type="password" id="admin_password" placeholder="Password" pattern="^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,64}$" title="Atleast 8 characters, including lowercase, uppercase and numbers. Must not be equal to the email address." required>
          <div class="bar"><i></i></div>
          <input type="password" id="admin_password_confirm" placeholder="Configm Password" pattern="^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,64}$" required>
          <br>
          <label for="admin_local_only" id="label_admin_local_only">Allow admin login only from localhost</label>
          <input type="checkbox" id="admin_local_only">
          <input name='adminLocalOnly' type="hidden" id="admin_local_only_hidden" required>
          <br>

          <p></p>
          <button id="next0" type='button' disabled>Continue</button>

        </div>

        <div id="step1" class="hidden section">

          <h2>User settings</h2>
          <label for="user_registration_confirmation" id="label_user_allow_registration">Allow public user registration</label>
          <select name='publicSignup' id="user_registration_confirmation" required>
            <option value="false">Off</option>
            <option value="email">On, require email confirmation</option>
            <option value="admin">On, require admin confirmation</option>
            <option value="true">On, no confirmation</option>
          </select><br>

          <p></p>
          <button id="back1" type='button'>Back</button>
          <button id="next1" type='button'>Continue</button>

        </div>

        <div id="step2" class="hidden section">

          <h2>General settings</h2>
          <label for="host_url" id="label_host_url">Host URL:</label><br>
          <input name="hostUrl" type="url" id="host_url" value="http://localhost:4000" placeholder="http://localhost:4000" title="This has to be a public reachable URL to this server." required><br>

          <label for="shortlink_checkbox" id="label_shortlink_checkbox">Use also for shortlink URL:</label>
          <input type="checkbox" id="shortlink_checkbox" checked><br>
          <label for="shortlink_url" id="label_shortlink_url" class="hidden">Shortlink URL:</label><br>
          <input name="shortLinkStub" type="url" id="shortlink_url" value="http://localhost:4000" placeholder="http://localhost:4000" class="hidden" title="This has to be a public reachable URL to this server." required>

          <p></p>

          <label for="peername" id="label_peername">Peer name:</label><br>
          <input name='peername' type="text" id="peername" value="anonymous" placeholder="anonymous" title="The peername can help to more easily identify peers." required><br>

          <p></p>

          <label for="backend_push" id="label_backend_push">Push to backend</label>
          <input type="checkbox" id="backend_push" title="Push harvested data to the following peers" checked>
          <input name='backendPushEnabled' type="hidden" id="backend_push_hidden" required><br>

          <p></p>

          <div id="backend_settings">
            <label for="backends" id="label_backends">Backends (comma separated):</label><br>
            <input name='backend' type="text" id="backends" value="http://loklak.org" placeholder="http://loklak.org" title="Push harvested data to the following peers" required><br>
          </div>

          <p></p>
          <button id="back2" type='button'>Back</button>
          <button id="next2" type='button' disabled>Continue</button>

        </div>

        <div id="step3" class="hidden section">

          <h2>SMTP settings</h2>
          <label for="smtp_enabled">Enable Emails via SMTP</label>
          <input type="checkbox" id="smtp_enabled">
          <input name='smtpEnabled' type="hidden" id="smtp_enabled_hidden" required>
          <label for="smtp_enabled" id="label_smtp_enabled"></label>
          <p></p>

          <div id="smtp_settings" class="hidden">

            <input name='smtpHostName' type="text" id="smtp_host" placeholder="Hostname" title="Enter the hostname here (e.g. smtp.loklak.org)" required>
            <div class="bar"><i></i></div>
            <input name='smtpEmail' type="email" id="smtp_email" placeholder="Email address" title="Enter your email address here. If you configured aliases on the server, you can use them here." required><br>
            <div class="bar"><i></i></div>
            <input name='smtpDisplayname' type="text" id="smtp_displayname" placeholder="Display name" title="Enter the name here that gets displayed with the email address, e.g. Admin" required><br>
            <div class="bar"><i></i></div>
            <input name='smtpUsername' type="text" id="smtp_username" placeholder="Username" title="The login name. Usually the email-address, but not necessarily" required><br>
            <div class="bar"><i></i></div>
            <input name="smtpPassword" type="password" id="smtp_password" placeholder="Password" required><br>

            <p></p>

            <table>
              <tr>
                <th><label for="smtp_port" id="label_smtp_port">Port:</label></th>
                <th><input name="smtpHostPort" type="number" id="smtp_port" min="1" max="65535" value="587" required></th>
              </tr>
              <tr>
                <th><label for="smtp_encryption" id="label_smtp_encryption">Encryption:</label></th>
                <th>
                  <select name="smtpHostEncryption" id="smtp_encryption" required>
                    <option value="starttls">StartTLS</option>
                    <option value="tls">TLS</option>
                    <option value="none">none</option>
                  </select>
                </th>
              </tr>
              <tr>
                <th><label for="smtp_disable_certificate_checking" id="label_smtp_disable_certificate_checking">Disable certificate checking:</label></th>
                <th>
                  <input type="checkbox" id="smtp_disable_certificate_checking">
                  <input name='smtpDisableCertificateChecking' type="hidden" id="smtp_disable_certificate_checking_hidden" required>
                </th>
              </tr>
            </table>

            <p></p>

            <button id="smtp_test_button" type='button'>Test settings</button>
            <label for="smtp_test_button" id="label_smtp_test_button"></label>
          </div>

          <p></p>
          <button id="back3" type='button'>Back</button>
          <button id="next3" type='button'>Continue</button>

        </div>

        <div id="step4" class="hidden section">

          <h2>HTTPS settings</h2>

          <label for="certificates_trust_selfsigned" id="label_certificates_trust_selfsigned">Trust self-signed certificates:</label>
          <select name="trustSelfSignedCerts" id="certificates_trust_selfsigned" required>
            <option value="none">None</option>
            <option value="peers">Peers</option>
            <option value="all">All</option>
          </select><br>

          <p></p>

          <label for="https_mode" id="label_https_enabled">Enable HTTPS:</label>
          <select name="https_mode" id="https_mode" required>
            <option value="off">Off</option>
            <option value="on">On</option>
            <option value="redirect">Redirect</option>
            <option value="only">Only</option>
          </select><br>

          <p></p>

          <div id="https_settings" class="hidden">
            <label for="https_key_source" id="label_https_key_source">Key source:</label><br>
            <select name="httpsKeySource" id="https_key_source" required disabled>
              <option value="keystore" selected>Java Keystore</option>
              <option value="key-cert">PEM-Files</option>
            </select>

            <p></p>

            <div id="https_keystore_settings">
              <input name="httpsKeystore" type="text" id="https_keystore_name" placeholder="Keystore name (e.g. keystore.jks" required disabled>
              <div class="bar"><i></i></div>
              <input name="httpsKeystorePassword" type="password" id="https_keystore_password" placeholder="Keystore password" required disabled><br>
            </div>

            <div id="https_keycert_settings" class="hidden">
              <input name="httpsKey" type="text" id="https_key" placeholder="Key file (e.g /etc/ssl/private/loklak_key.pem)" required disabled>
              <div class="bar"><i></i></div>
              <input name="httpsCert" type="text" id="https_cert" placeholder="Certificate (e.g. /etc/ssl/certs/loklak_cert_full_chain.pem)" required disabled><br>
            </div>

          </div>

          <p></p>
          <button id="back4" type='button'>Back</button>
          <button id="next4" type='button'>Continue</button>

        </div>

        <div id="step5" class="hidden section">

          <h2>Finish installation</h2>

          <textarea id="summary" class="text" cols="80" rows="20" readonly></textarea><br>
          <label for="summary_show_passwords" id="label_summary_show_passwords">Show posswords:</label>
          <input type="checkbox" id="summary_show_passwords">

          <p></p>

          <button id="back5" type='button'>Back</button>
          <button id="submit" type='button'>Submit</button>
        </div>
      </form>
      <br>
      <form id="abort_form">
        <input type="hidden" name="abort" value="true">
        <button id="abort_button" type="button">Abort</button>
      </form>
      <form id="finish_form" class="hidden">
        <input type="hidden" name="finish" value="true">
      </form>
      <div id="finish" class="form hidden">
        <p>The installation wizard will shut down now.</p>
      </div>
    </div>

    <script src="js/jquery.min.js"></script>
    <script src="js/jquery.form.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="js/installation.js"></script>
  </body>
</html>
